<?php

namespace common\model;

use think\model\RelationModel;
use teamones\dbeventObserver\SplSubjectEnforcer;
use teamones\dbeventObserver\interfaces\SplSubject;

class ProjectCapacityReportMonthModel extends RelationModel implements SplSubject
{

    const TYPE_INER_NUMBER = 1; // 内部产能
    const TYPE_OUT_NUMBER = 2; // 外部产能
    const TYPE_REQUIREMENT = 3; // 预估需求量

    use SplSubjectEnforcer;

    // 自动验证
    protected $_validate = [
        ['project_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['step_category_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['number', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
    ];

    // 自动完成
    protected $_auto = [
        ['tenant_id', 'auto_fill_tenant_id', self::MODEL_INSERT, 'function'],

        ['created_by', 'fill_created_by', self::MODEL_INSERT, 'function'],
        ['updated_by', 'fill_created_by', self::MODEL_UPDATE, 'function'],
        ['created', 'time', self::MODEL_INSERT, 'function'],
        ['updated', 'time', self::MODEL_UPDATE, 'function'],
    ];
}
